// pages/user/dingdan.js
//index.js  
//获取应用实例  
var app = getApp();
var common = getApp();
Page({
  data: {
    winWidth: 0,
    winHeight: 0,
    // tab切换  
    currentTab: 0,
    isStatus: 1,//1待付款，2待收货，3已完成
    page: 1,
    orderList0: [

    ],
    orderList1: [],
    orderList2: [],
    orderList3: [],
    orderList4: [],
    order5: [
      {
        'text': "单县佳泰商贸有限公司主营Pos机，商超管理软件。",
        'ImgUrl': '../../images/logo.jpg'
      }
    ],
    ItemData: [
      {


      }

    ]

  },
  onLoad: function (options) {
    var objectId = options.ming;


    console.log(options);


  },
  getOrderStatus: function () {
    return this.data.currentTab == 0 ? 1 : this.data.currentTab == 2 ? 2 : this.data.currentTab == 3 ? 3 : 0;
  },

  initOrderList: function (data) {
    for (var i = 0; i < data.length; i++) {
      console.log(data[i]);
      var item = data[i];

      item.ImgUrl = app.d.hostImg + item.ImgUrl;
      item.price = item.price / 100;
      item.BuyMoney = item.BuyMoney / 100;
      item.TotalAmount = item.TotalAmount / 100;
      item.TotalMoney = item.TotalMoney / 100;
      item.ProductImgUrl = app.d.hostImg + item.ProductImgUrl;
    }
  },

  // returnProduct:function(){
  // },
  initSystemInfo: function () {
    var that = this;

    wx.getSystemInfo({
      success: function (res) {
        that.setData({
          winWidth: res.windowWidth,
          winHeight: res.windowHeight
        });
      }
    });
  },
  bindChange: function (e) {

    var that = this;
    that.setData({ currentTab: e.detail.current });

  },
  swichNav: function (e) {

    var that = this;

    if (this.data.currentTab === e.target.dataset.current) {
      return false;
    } else {
      that.setData({
        currentTab: parseInt(e.target.dataset.current),
      });
      that.setData({
        isStatus: this.getOrderStatus(),
      });


    };
  }


})